﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Backend.JYD.Model;

namespace Backend.JYD.BLL
{
    public class EmpInfoBLL
    {
        private static readonly IDAL.IEmpInfo idal = Factory.DALFactory.CreateEFDAL<IDAL.IEmpInfo>("DAL.EmpInfoDAL");

        public EmpInfo GetLoginEmpInfo(string loginName, string pwd)
        {
            return idal.GetLoginEmpInfo(loginName, pwd);
        }
        /// <summary>
        /// isAll = false 过滤不可用用户
        /// </summary>
        public List<EmpInfo> GetEmpInfoByEmpIds(List<Int64> empIds, bool isAll)
        {
            if (empIds == null || empIds.Count <= 0) return null;
            return idal.GetEmpInfoByEmpIds(empIds, isAll);
        }

        public string GetEmpNameById(List<EmpInfo> infos, Int64 empId)
        {
            if (infos == null || empId <=0) return string.Empty;

            var info = infos.Find(p => p.EmpId == empId);
            return info == null ? string.Empty : info.EmpName;
        }
    }
}
